//
//  PolicyHttpTools.m
//  Village
//
//  Created by 程虎 on 2017/9/25.
//  Copyright © 2017年 程虎. All rights reserved.
//

#import "PolicyHttpTools.h"
#import "PolicyModel.h"

@implementation PolicyHttpTools

+ (void)GetPolicyWithPageNum:(NSInteger )pagenum Success:(void (^)(NSDictionary *valueDict))success failure:(void (^)(NSString *error))failure
{
    NSMutableDictionary *bean = [NSMutableDictionary dictionary];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [bean setValue:dict forKey:@"entitybean"];
    [dict setObject:@"5" forKey:@"pagesize"];
    [dict setObject:[NSString stringWithFormat:@"%ld",pagenum] forKey:@"pagenum"];
    //        [dict setObject:[Globle getInstance].account.areaid.length > 0 ? [Globle getInstance].account.areaid : ([Globle getInstance].areaid.length > 0 ? [Globle getInstance].areaid :@"") forKey:@"areaid"];
    [dict setObject:@"110101000000000000" forKey:@"areaid"];
    [NetRequestClass Post:searchporegulationsURL Parameters:bean success:^(id result) {
        if (success) {
            success(result[@"data"]);
        }
    } failure:^(id valueCode, id error) {
        if (failure) {
            failure(error);
        }
    }];
}

/**
 增加阅读数
 */
+ (void)AddPolicyReadNumWithID:(NSString *)policyID Success:(void (^)())success failure:(void (^)(NSString *error))failure
{
    NSMutableDictionary *entitybean = [NSMutableDictionary dictionary];
    NSMutableDictionary *dict = [NSMutableDictionary dictionary];
    [entitybean setValue:dict forKey:@"entitybean"];
    [dict setObject:policyID forKey:@"id"];
    
    [NetRequestClass Post:updateporegulationsURL Parameters:entitybean success:^(id result) {
        if (success) {
            success();
        }
    } failure:^(id valueCode, id error) {
        if (failure) {
            failure(error);
        }
    }];
}
@end
